<template>
  <div id="city">
    <!-- 1111 -->
    <div class="colation">
      <div class="iconfont colation-left">&#xe633; 自动定位 : {{this.$store.state.tcity}}</div>
      <router-link to="/changeCity">
        <div class="iconfont colation-right">切换&#xe616;</div>
       </router-link>
    </div>
    
    <!-- 2222 -->
    <div class="sort">
      <div class="sort-box" 
      v-for="(item,index) in sortList" 
      :key="index">
        <img :src="item.imgSrc" />
        <div class="sort-name">{{item.name}}</div>
        
      </div>

    </div>
    <!-- 33333 -->
    <div class="video-list">
      
      <div class="item" 
        v-for="(item,index) in videolist" 
        :key="index"
        >
        <div class="video">
          <videos :videos="item"></videos>
        </div>
        <div class="title">
          我爱学习
          我爱学习
          我爱学习
          我爱学习
        </div>
      </div>
      
      <!-- 占位 -->
      <div class="h-50"></div>
    </div>

  </div>
</template>

<script>
import videos from './video.vue'
import axios from 'axios'
export default {
  name: 'city',
  components:{
    videos
  },
  data(){
    return{
      videolist:[],
      sortList:[
        {
          imgSrc:require('../../../assets/img/delicacy.jpg'),
          name:'美食'
        },
        {
          imgSrc:require('../../../assets/img/scenic.jpg'),
          name:'景点'
        },
        {
          imgSrc:require('../../../assets/img/culture.jpg'),
          name:'文化'
        },
        {
          imgSrc:require('../../../assets/img/fun.jpg'),
          name:'玩乐'
        },
        {
          imgSrc:require('../../../assets/img/shopping.jpg'),
          name:'购物'
        },
        {
          imgSrc:require('../../../assets/img/hotel.jpg'),
          name:'酒店'
        },
        {
          imgSrc:require('../../../assets/img/sport.jpg'),
          name:'运动'
        },
      ]
    }
  },
  mounted() {
    this.getVideos()
  },
  methods:{
    getVideos(){
      axios.get('api/videos.json')
      .then(this.getVideosSucc)
    },
    getVideosSucc(res){
      this.videolist = res.data.list
    }
    
  }
  
};
</script>

<style scoped>
  /* 隐藏滑动条 */
::-webkit-scrollbar{
  display: none;
}
.h-100{
  width: 100%;
  height: 1.5rem;
  background: #000000;
}

#city {
  padding: 0.02rem;
  width: 100%;
}
/* 11111 */
#city .colation {
  width: 100%;
  height: 0.8rem;
  line-height: 0.8rem;
  margin-top: 1.2rem;
  border-bottom: 0.01rem solid #c3c3c3;
  overflow: hidden;
}
.colation .colation-left {
  float: left;
  margin-left: 0.3rem;
  font-size: 0.3rem;
  color: #bbb;
}
.colation .colation-right {
  float: right;
  margin-right: 0.3rem;
  font-size: 0.3rem;
  color: #bbb;
}


/* 2222 */
#city .sort{
  width: 100%;
  height: 2rem;
  /* 超出可滑动 */
  overflow: auto;
  display: flex;
}
#city .sort .sort-box{
  width: 1.5rem;
  height: 2rem;
  /* 超出可滑动 */
  flex-shrink: 0;
}
#city .sort .sort-box img{
  width: 1rem;
  height: 1rem;
  border-radius: .1rem;
  margin: .2rem .25rem;
}
#city .sort .sort-box .sort-name{
  width: 1rem;
  height: .3rem;
  line-height: .3rem;
  text-align: center;
  margin: 0 .25rem;
}

/* 333 */
#city .video-list{
  width: 100%;
  overflow: hidden;
  background-color: #000000;
}
#city .video-list .item{
  width: 50%;
  float: left;
}
#city .video-list .item .video{
  width: 90%;
  margin-left: 5%;
}
#city .video-list .item .title{
  color: #FFFFFF;
  line-height: .5rem;
  font-size: .3rem;
  margin-top: .2rem;
  padding-left:.2rem;
}
</style>
